﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using DemoForLinq.Common;

namespace DemoForLinq.Chapter1
{
    class Demo1_5_InvokePublicMethod
    {
        static void Main(string[] args)
        {
            ArrayList alEmployees = Employee.GetEmployees();
            Contact[] contacts = alEmployees.Cast<Employee>().Select(e => new Contact
                                                                              {
                                                                                  Id = e.id, 
                                                                                  Name = string.Format("{0} {1}", e.firstName, e.lastName)
                                                                              }).ToArray();
            Contact.PublishContacts(contacts);
        }
    }
}
